/**
 * 通过mock模拟getUser接口数据
 * @param{Object} options 请求体:body,请求类型:type,请求路径:url
 */

export const menus = options => {
  let data = [
    {
      id: 125,
      authName: "用户管理",
      path: "users",
      children: [
        {
          id: 110,
          authName: "用户列表",
          path: "users",
          children: [],
          order: null
        }
      ],
      order: 1
    },
    {
      id: 103,
      authName: "权限管理",
      path: "permissions",
      children: [
        {
          id: 111,
          authName: "权限列表",
          path: "permissions",
          children: [],
          order: 2
        },
        {
          id: 112,
          authName: "角色列表",
          path: "role",
          children: [],
          order: 1
        }
      ],
      order: 2
    },
    {
      id: 101,
      authName: "商品管理",
      path: " ",
      children: [
        {
          id: 113,
          authName: "商品列表",
          path: "goods",
          children: [],
          order: 1
        },
        {
          id: 114,
          authName: "分类参数",
          path: "cateparams",
          children: [],
          order: 2
        },
        {
          id: 115,
          authName: "商品分类",
          path: "goodscate",
          children: [],
          order: 3
        }
      ],
      order: 3
    },
    { id: 102, authName: "订单管理", path: " ", children: [], order: 4 },
    { id: 145, authName: "数据统计", path: " ", children: [], order: 5 }
  ];
  let result = {
    data: data,
    msg: "获取导航信息成功",
    statusCode: "200"
  };
  return result;
};

export const getpermissiontree = options => {
  let Permissiontree = [
    {
      id: 101,
      authName: "商品管理",
      path: null,
      pid: 0,
      children: [
        {
          id: 104,
          authName: "商品列表",
          path: null,
          pid: 101,
          children: [
            {
              id: 105,
              authName: "添加商品",
              path: null,
              pid: "104,101"
            }
          ]
        }
      ]
    },
    {
      id: 102,
      authName: "人员管理",
      path: null,
      pid: 0,
      children: [
        {
          id: 106,
          authName: "人员列表",
          path: null,
          pid: 102,
          children: [
            {
              id: 107,
              authName: "添加人员",
              path: null,
              pid: "106,102"
            }
          ]
        }
      ]
    }
  ];
  let result = {
    permissiontree: Permissiontree,
    statusCode: "200",
    msg: "获取权限树形列表成功"
  };
  return result;
};

export const deletePermission = options => {
  return {
    statusCode: "200",
    msg: "删除权限成功!"
  };
};

export const getRoleList = options => {
  // let Permissionlist = [
  //   { perid: 1, pername: "商品管理", perleavel: "0", perpath: "goods" },
  //   { perid: 2, pername: "用户管理", perleavel: "2", perpath: "goods" },
  //   { perid: 3, pername: "权限管理", perleavel: "1", perpath: "goods" },
  //   { perid: 4, pername: "密码管理", perleavel: "2", perpath: "goods" },
  //   { perid: 5, pername: "档案管理", perleavel: "1", perpath: "goods" },
  //   { perid: 6, pername: "角色管理", perleavel: "1", perpath: "goods" },
  //   { perid: 7, pername: "人员管理", perleavel: "2", perpath: "goods" },
  //   { perid: 8, pername: "在线管理", perleavel: "1", perpath: "goods" }
  // ];

  // let rolelist = [
  //   {
  //     id: 1,
  //     rolename: "主管",
  //     roleDesc: "技术负责人",
  //     Permissionlist: Permissionlist
  //   },
  //   {
  //     id: 2,
  //     rolename: "测试角色",
  //     roleDesc: "测试角色描述",
  //     Permissionlist: Permissionlist
  //   },
  //   {
  //     id: 3,
  //     rolename: "测试角色2",
  //     roleDesc: "测试角色描述2",
  //     Permissionlist: Permissionlist
  //   },
  //   {
  //     id: 4,
  //     rolename: "超级管理员",
  //     roleDesc: "超级管理员",
  //     Permissionlist: Permissionlist
  //   },
  //   {
  //     id: 5,
  //     rolename: "test",
  //     roleDesc: "test",
  //     Permissionlist: Permissionlist
  //   }
  // ];
  let peo = [
    {
      id: 30,
      roleName: "主管",
      roleDesc: "技术负责人",
      children: [
        {
          id: 101,
          authName: "商品管理",
          path: null,
          children: [
            {
              id: 104,
              authName: "商品列表",
              path: null,
              children: [
                {
                  id: 105,
                  authName: "添加商品",
                  path: null
                },
                {
                  id: 106,
                  authName: "修改商品",
                  path: null
                },
                {
                  id: 107,
                  authName: "删除商品",
                  path: null
                },
                {
                  id: 108,
                  authName: "搜索商品",
                  path: null
                },
                {
                  id: 109,
                  authName: "查看商品",
                  path: null
                },
                {
                  id: 110,
                  authName: "统计商品",
                  path: null
                }
              ]
            }
          ]
        }
      ]
    }
  ];

  let result = {
    peo: peo,
    statusCode: "200",
    msg: "获取角色权限列表成功"
  };
  return result;
};

export const getPermissionlist = options => {
  let Permissionlist = [
    { perid: 1, pername: "商品管理", perleavel: "0", perpath: "goods" },
    { perid: 2, pername: "用户管理", perleavel: "2", perpath: "goods" },
    { perid: 3, pername: "权限管理", perleavel: "1", perpath: "goods" },
    { perid: 4, pername: "密码管理", perleavel: "2", perpath: "goods" },
    { perid: 5, pername: "档案管理", perleavel: "1", perpath: "goods" },
    { perid: 6, pername: "角色管理", perleavel: "1", perpath: "goods" },
    { perid: 7, pername: "人员管理", perleavel: "2", perpath: "goods" },
    { perid: 8, pername: "在线管理", perleavel: "1", perpath: "goods" }
  ];
  let result = {
    permissionlist: Permissionlist,
    statusCode: "200",
    msg: "获取权限列表成功"
  };
  return result;
};

export const setRole = options => {
  return {
    statusCode: "200",
    msg: "设置角色成功"
  };
};

export const getRoles = options => {
  let rolelist = [
    { roleid: 1, rolename: "管理员" },
    { roleid: 2, rolename: "测试员" },
    { roleid: 3, rolename: "工程师" },
    { roleid: 4, rolename: "普通人员" }
  ];
  let result = {
    rolelist: rolelist,
    statusCode: "200"
  };
  return result;
};

export const updateStatus = options => {
  return {
    statusCode: "200",
    msg: "设置状态成功"
  };
};

export const userUpdate = options => {
  return {
    statusCode: "200",
    msg: "修改成功"
  };
};

export const userDel = options => {
  return {
    statusCode: "200",
    msg: "删除成功"
  };
};

export const userAdd = options => {
  return {
    statusCode: "201",
    msg: "添加成功"
  };
};

export const getUser = options => {
  return {
    username: "admin",
    password: "123",
    msg: "success",
    token: "123"
  };
};

export const getUserList = options => {
  let users = [
    {
      id: 1,
      username: "小一",
      email: "136@qq.com",
      data: "2017-01-06",
      status: true
    },
    {
      id: 2,
      username: "小二",
      email: "123@qq.com",
      data: "2018-09-06",
      status: false
    },
    {
      id: 2,
      username: "小三",
      email: "178@qq.com",
      data: "2021-12-06",
      status: true
    }
  ];

  let result = {
    users: users,
    pagenum: 1,
    total: 3
  };

  return result;
};
